Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/common/src/commonMain/kotlin/org/meshtastic/core/common/database/DatabaseManager.kt 2d20cd8a4708e2ef66e98d5259f3a97ec93f240a (2d20cd8a) Text, 2.91 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.common.database

Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow

T8b949e/** Interface for managing database instances and cache limits. */
Tff7b72interface T56d364DatabaseManager Tb4b4b4{
T8b949e/** Reactive stream of the current database cache limit. */
Tff7b72val Te6edf3cacheLimitTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657IntTff7b72>

T8b949e/** Returns the current database cache limit from storage. */
Tff7b72fun Td2a8ffgetCurrentCacheLimitTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Int

T8b949e/** Sets the database cache limit. */
Tff7b72fun Td2a8ffsetCacheLimitTb4b4b4(Te6edf3limitTb4b4b4: Tffa657IntTb4b4b4)

T8b949e/** Switches the active database to the one associated with the given [address]. */
Tff7b72suspend Tff7b72fun Td2a8ffswitchActiveDatabaseTb4b4b4(Te6edf3addressTb4b4b4: Tffa657String?Tb4b4b4)

T8b949e/**
* Associates the connection identified by [address] with the physical device learned from its radio handshake, so
* the same device reached over a different transport (BLE / TCP / USB) shares one database. Implementations must
* reject an address that is no longer active, preventing a stale identity emission from claiming or merging the
* newly selected transport's database. The first transport to report the device claims its active DB; a later
* transport folds its own data in and switches to the claimed DB. Idempotent once a device/transport pair has been
* unified.
*
* [deviceId] is the factory-burned hardware id from MyNodeInfo (null/blank when the platform or firmware doesn't
* report one, or when lockdown zeroes it). It is the preferred claim key because it survives the node-number
* changes firmware 2.8 introduced (`my_node_num = crc32(public_key)` renumbers on upgrade, erase, and re-key);
* [nodeNum] remains the fallback claim for hardware without a device id and for claims made by older app versions.
*
* The caller must hold a transport-session lifecycle lease for the full call. [isSessionActive] must represent that
* lease, not merely whether new work may still be admitted, so association rollover cannot overlap the destination
* transaction commit.
*/
Tff7b72suspend Tff7b72fun Td2a8ffassociateDeviceTb4b4b4(Te6edf3addressTb4b4b4: Tffa657StringTb4b4b4, Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3deviceIdTb4b4b4: Tffa657String?Tb4b4b4, Te6edf3isSessionActiveTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657BooleanTb4b4b4)

T8b949e/** Returns true if a database exists for the given device address. */
Tff7b72fun Td2a8ffhasDatabaseForTb4b4b4(Te6edf3addressTb4b4b4: Tffa657String?Tb4b4b4)Tb4b4b4: Tffa657Boolean
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s